﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace ThunderboltCustomControlLibrary
{
	public class IconButton : Button
	{
		static IconButton()
		{
			DefaultStyleKeyProperty.OverrideMetadata(typeof(IconButton), new FrameworkPropertyMetadata(typeof(IconButton)));
		}
		#region 依赖属性

		//图片
		public ImageSource Icon
		{
			get { return (ImageSource)GetValue(IconProperty); }
			set { SetValue(IconProperty, value); }
		}

		// Using a DependencyProperty as the backing store for Icon.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty IconProperty =
			DependencyProperty.Register("Icon", typeof(ImageSource), typeof(IconButton));

		//图片尺寸
		public double IconSize
		{
			get { return (double)GetValue(IconSizeProperty); }
			set { SetValue(IconSizeProperty, value); }
		}

		// Using a DependencyProperty as the backing store for IconSize.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty IconSizeProperty =
			DependencyProperty.Register("IconSize", typeof(double), typeof(IconButton), new PropertyMetadata(25d));

		//图片与文字间隔
		public Thickness IconMargin
		{
			get { return (Thickness)GetValue(IconMarginProperty); }
			set { SetValue(IconMarginProperty, value); }
		}

		// Using a DependencyProperty as the backing store for IconMargin.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty IconMarginProperty =
			DependencyProperty.Register("IconMargin", typeof(Thickness), typeof(IconButton));

		//图片与文字排列方式
		public Orientation Orientation
		{
			get { return (Orientation)GetValue(OrientationProperty); }
			set { SetValue(OrientationProperty, value); }
		}

		// Using a DependencyProperty as the backing store for Orientation.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty OrientationProperty =
			DependencyProperty.Register("Orientation", typeof(Orientation), typeof(IconButton));
		#endregion
	}
}